package com.itheima.Demo2;


import java.util.ArrayList;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class StreamDemo2 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();

        list.add("张三");
        list.add("李四");
        list.add("王五");
        list.add("赵六");
        list.add("钱七");
        list.add("张三");

//        list.stream().limit(2).forEach(s -> System.out.println(s));
//
//        System.out.println("===============");
//        list.stream().skip(2).forEach(s -> System.out.println(s));

        ArrayList<String> list2 = new ArrayList<>();

        list2.add("张三");
        list2.add("李四");
        list2.add("王五");
        list2.add("赵六");
        list2.add("钱七");
        list2.add("张三");

//        Stream<String> stream1 = list.stream();
//        Stream<String> stream2 = list2.stream();
//
//        Stream<String> stream3 = Stream.concat(stream1,stream2);
//        stream3.forEach(s -> System.out.println(s));

//        Stream.concat(list.stream(),list2.stream()).forEach(s -> System.out.println(s));

//        list.stream().distinct().forEach(s -> System.out.println(s));

//        list.stream().forEach(new Consumer<String>() {
//            @Override
//            public void accept(String s) {
//                System.out.println(s);
//            }
//        });

//        list.stream().forEach(s -> System.out.println(s));

//        long count = list.stream().count();
//        System.out.println(count);
    }
}
